//
//  ToBeChangeTaskDetailCell.m
//  MyProject
//
//  Created by Pei on 16/7/30.
//  Copyright © 2016年 Xiaobo Pei. All rights reserved.
//

#import "ToBeChangeTaskDetailCell.h"


@implementation ToBeChangeTaskDetailCell
{
    //UIControl *checkItemControl;
    //UIButton *seeBtn;
    UILabel *itemDetailLbl;
    UILabel *checkDetailLbl;
    UILabel *koufenDetailLbl;
    UILabel *riskDetailLbl;
    //UIButton *passBtn;
}

@synthesize checkItemControl, seeBtn, passBtn,fullControl;

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        self.backgroundColor = kWhiteColor;
        
        //_footView = [[UIView alloc] init];
        //_footView.frame = CGRectMake(0.0f, 0.0f, kDeviceWidth, 54.0f*4.0+10.0f);
        //_footView.backgroundColor = kWhiteColor;
        
        UIView *topView = [[UIView alloc] init];
        topView.frame = CGRectMake(0.0f, 0.0f, kDeviceWidth, 10.0f);
        topView.backgroundColor = kDefaultBackgroundColor;
        [self addSubview:topView];
        
        checkItemControl = [[UIControl alloc] init];
        checkItemControl.frame = CGRectMake(0.0f, 10.0f, kDeviceWidth, 54.0f);
        [self addSubview:checkItemControl];
        
        UIImageView *arrowImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"02jiantou-"]];
        arrowImageView.frame = CGRectMake(kDeviceWidth-16.0f-10.0f/2.0f, (54.0f-19.0f/2.0f)/2.0f, 10.0f/2.0f, 19.0f/2.0f);
        [checkItemControl addSubview:arrowImageView];
        
        UILabel *checkLbl = [[UILabel alloc] init];
        checkLbl.frame = CGRectMake(16.0f, (54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        checkLbl.font = kAppFont(Home_Small_Size+2);
        checkLbl.textColor = kRGB(205, 206, 207);
        checkLbl.text = @"检查内容：";
        [checkItemControl addSubview:checkLbl];
        
        checkDetailLbl = [[UILabel alloc] init];
        checkDetailLbl.frame = CGRectMake(checkLbl.right, (54.0f-(Home_Small_Size))/2.0f, kDeviceWidth-16.0f-checkLbl.width-arrowImageView.width-16.0f, Home_Small_Size);
        checkDetailLbl.font = kAppFont(Home_Small_Size);
        checkDetailLbl.textColor = kRGB(100, 99, 104);
        checkDetailLbl.text = @"";
        [checkItemControl addSubview:checkDetailLbl];
        
        UIView *lineView0 = [[UIView alloc] init];
        lineView0.frame = CGRectMake(16.0f, 53.5f, kDeviceWidth-16.0f, 0.5f);
        lineView0.backgroundColor = kGreenColor;
        [checkItemControl addSubview:lineView0];
        
        UILabel *itemLbl = [[UILabel alloc] init];
        itemLbl.frame = CGRectMake(16.0f, checkItemControl.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        itemLbl.font = kAppFont(Home_Small_Size+2);
        itemLbl.textColor = kRGB(205, 206, 207);
        itemLbl.text = @"检查描述：";
        [self addSubview:itemLbl];
        
        itemDetailLbl = [[UILabel alloc] init];
        itemDetailLbl.frame = CGRectMake(checkLbl.right, checkItemControl.bottom+(54.0f-(Home_Small_Size))/2.0f, kDeviceWidth-16.0f-checkLbl.width-16.0f, Home_Small_Size);
        itemDetailLbl.font = kAppFont(Home_Small_Size);
        itemDetailLbl.textColor = kRGB(100, 99, 104);
        itemDetailLbl.text = @"";
        [self addSubview:itemDetailLbl];
        
        UIView *lineView1 = [[UIView alloc] init];
        lineView1.frame = CGRectMake(16.0f, 54.0f*2.0f+10.0f-0.5f, kDeviceWidth-16.0f, 0.5f);
        lineView1.backgroundColor = kGreenColor;
        [self addSubview:lineView1];
        
        
        UILabel *riskLbl = [[UILabel alloc] init];
        riskLbl.frame = CGRectMake(16.0f, lineView1.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 70, Home_Small_Size+2);
        riskLbl.font = kAppFont(Home_Small_Size+2);
        riskLbl.textColor = kRGB(205, 206, 207);
        riskLbl.text = @"隐患类型：";
        [self addSubview:riskLbl];
        
        riskDetailLbl = [[UILabel alloc] init];
        riskDetailLbl.frame = CGRectMake(riskLbl.right, lineView1.bottom+(54.0f-(Home_Small_Size))/2.0f, kDeviceWidth-16.0f-riskLbl.width-16.0f, Home_Small_Size);
        riskDetailLbl.font = kAppFont(Home_Small_Size);
        riskDetailLbl.textColor = kRGB(100, 99, 104);
        riskDetailLbl.text = @"";
        [self addSubview:riskDetailLbl];
        
        UIView *lineView11 = [[UIView alloc] init];
        lineView11.frame = CGRectMake(16.0f, 54.0f*3.0f+10.0f-0.5f, kDeviceWidth-16.0f, 0.5f);
        lineView11.backgroundColor = kGreenColor;
        [self addSubview:lineView11];
        
        
        UILabel *koufenLbl = [[UILabel alloc] init];
        koufenLbl.frame = CGRectMake(16.0f, lineView11.bottom+(54.0f-(Home_Small_Size+2))/2.0f, 45, Home_Small_Size+2);
        koufenLbl.font = kAppFont(Home_Small_Size+2);
        koufenLbl.textColor = kRGB(205, 206, 207);
        koufenLbl.text = @"扣分：";
        [self addSubview:koufenLbl];
        
        koufenDetailLbl = [[UILabel alloc] init];
        koufenDetailLbl.frame = CGRectMake(koufenLbl.right, lineView11.bottom+(54.0f-(Home_Small_Size))/2.0f, 40, Home_Small_Size);
        koufenDetailLbl.font = kAppFont(Home_Small_Size);
        koufenDetailLbl.textColor = kRGB(25, 151, 198);
        koufenDetailLbl.text = @"6";
        [self addSubview:koufenDetailLbl];
        
        
        seeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        seeBtn.frame = CGRectMake(kDeviceWidth-(kDeviceWidth-16*4)/3.0f-16.0f, lineView11.bottom+(54.0f-40.0f)/2.0f, (kDeviceWidth-16*4)/3.0f, 40.0f);
        [seeBtn setBackgroundColor:kRGB(113, 122, 162)];
        [seeBtn setTitle:@"查看图片" forState:UIControlStateNormal];
        seeBtn.layer.cornerRadius = 5.0f;
        seeBtn.layer.masksToBounds = YES;
        //seeBtn.tag = 116;
        //[seeBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:seeBtn];
        
        passBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        passBtn.frame = CGRectMake(kDeviceWidth-(kDeviceWidth-16*4)/3.0f*2.0f-16.0f*2.0f, lineView11.bottom+(54.0f-40.0f)/2.0f, (kDeviceWidth-16*4)/3.0f, 40.0f);
        [passBtn setBackgroundColor:kBlueColor];
        [passBtn setTitle:@"填写整改" forState:UIControlStateNormal];
        passBtn.layer.cornerRadius = 5.0f;
        passBtn.layer.masksToBounds = YES;
        //passBtn.tag = 118;
        //[passBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:passBtn];
        
        UIView *lineView2 = [[UIView alloc] init];
        lineView2.frame = CGRectMake(0.0f, 54.0f*3.0f+10.0f-0.5f, kDeviceWidth, 0.5f);
        lineView2.backgroundColor = kGreenColor;
        [self addSubview:lineView2];
        
        fullControl = [[UIControl alloc] init];
        fullControl.frame = CGRectMake(0.0f, 10.0f, kDeviceWidth, 54*3);
        fullControl.backgroundColor = [UIColor clearColor];
        [self addSubview:fullControl];
        
        /*
         UIButton *refuseBtn = [UIButton buttonWithType:UIButtonTypeCustom];
         refuseBtn.frame = CGRectMake(16.0f, lineView2.bottom+(54.0f-40.0f)/2.0f, kDeviceWidth-16*2, 40.0f);
         [refuseBtn setBackgroundColor:kBlueColor];
         [refuseBtn setTitle:@"上传" forState:UIControlStateNormal];
         refuseBtn.layer.cornerRadius = 5.0f;
         refuseBtn.layer.masksToBounds = YES;
         refuseBtn.tag = 119;
         [refuseBtn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
         [_footView addSubview:refuseBtn];
         
         _myTable.tableFooterView = _footView;
         */
    }
    
    return self;
}
- (void)showWithData:(NSDictionary*)data{
    koufenDetailLbl.text = [NSString stringWithFormat:@"%d", [[data valueForKey:@"Points"] intValue]];
    checkDetailLbl.text = [data valueForKey:@"InspectContentDesc"];
    itemDetailLbl.text = [data valueForKey:@"InspectRiskDesc"];
    
//    NSArray *arrayT = [[NSUserDefaults standardUserDefaults] objectForKey:select_RiskLevel];
//    for (NSDictionary *yyy in arrayT) {
//        if ([[yyy valueForKey:@"Value"] intValue] == [[data valueForKey:@"RiskLevel"] intValue]) {
//            riskDetailLbl.text = [yyy valueForKey:@"Name"];
//        }
//    }
    riskDetailLbl.text = [data valueForKey:@"RiskTypeName"];
}

@end
